{template '_header'}
 
<div class="page-heading"> <h2>合伙人管理 <small>总数: <span class='text-danger'>{$total}</span></small></h2> </div>
   <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="ewei_shopv2" />
            <input type="hidden" name="do" value="web" />
            <input type="hidden" name="r" value="globonus.partner" />
            
<div class="page-toolbar row m-b-sm m-t-sm">
                            <div class="col-sm-4">
				 
			   <div class="input-group-btn">
			        <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
				  {ifp 'globonus.partner.edit'}
                                  <div class="btn-group btn-group-sm">
                                <button data-toggle="dropdown" class="btn btn-default">黑名单 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a class='btn' data-toggle='batch' data-href="{php echo webUrl('globonus/partner/partnerblack',array('partnerblack'=>1))}" data-confirm='确认要设置黑名单?'>设置黑名单</a></li>
                                    <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('globonus/partner/partnerblack',array('partnerblack'=>0))}" data-confirm='确认要取消黑名单?'>取消黑名单</a></li>
                                </ul>
                            </div>
                              
		                 <div class="btn-group btn-group-sm">
                                <button data-toggle="dropdown" class="btn btn-default">审核 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('globonus/partner/check',array('status'=>1))}"  data-confirm='确认要审核通过?'>审核通过</a></li>
                                    <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('globonus/partner/check',array('status'=>0))}" data-confirm='确认要取消审核?'>取消审核</a></li>
                                </ul>
                            </div>
                                 
				   {/if}
				 
                                           
				{ifp 'globonus.partner.delete'}	
			              <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('globonus/partner/delete')}"><i class='fa fa-trash'></i> 删除</button>
				 {/if}
			   </div> 
                               </div>	
 
			 
                            <div class="col-sm-7 pull-right">
			 	
			 <select name='partnerstatus' class='form-control  input-sm select-md' style="width:100px;"  >
                            <option value=''>状态</option>
                            <option value='0' {if $_GPC['partnerstatus']=='0'}selected{/if}>未审核</option>
                            <option value='1' {if $_GPC['partnerstatus']=='1'}selected{/if}>已审核</option>
                        </select>					 

                                <div class="input-group">
                                          <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="合伙人昵称/姓名/手机号"/>
				 <span class="input-group-btn">
                                
                                        <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
										<button class="btn btn-sm btn-default" type="button" onclick="$('#moresearch').toggle()"> 其他 <i class="fa fa-angle-down"></i></button> 
                                                                                	    {ifp 'globonus.partner.export'}
                        <button type="submit" name="export" value="1" class="btn btn-success btn-sm">导出</button>
                        {/if}
				</span>
                                </div>
								
                            </div>
</div>
            
				<div class="page-toolbar row" {if $_GPC['followed']=='' && $_GPC['level']=='' && $_GPC['groupid']=='' && $_GPC['isblack']=='' && $_GPC['time']['start']==''  && $_GPC['time']['end']=='' }style='display:none;'{/if} id='moresearch' >
					
					
					<div class="col-sm-12">
					 
			 	  <select name='followed' class='form-control  input-sm select-md' style="width:140px">
								<option value=''>关注</option>
								<option value='0' {if $_GPC['followed']=='0'}selected{/if}>未关注</option>
								<option value='1' {if $_GPC['followed']=='1'}selected{/if}>已关注</option>
								<option value='2' {if $_GPC['followed']=='2'}selected{/if}>取消关注</option>
							</select>	 
					 
	 
                      <select name='partnerlevel' class='form-control  input-sm select-md' style="width:140px;"  >
                            <option value=''>等级</option>
                            {loop $partnerlevels $level}
                            <option value='{$level['id']}' {if $_GPC['partnerlevel']==$level['id']}selected{/if}>{$level['levelname']}</option>
                            {/loop}
                        </select>
		 
                     				
						 
                       <select name='partnerblack'  class='form-control  input-sm select-md'   style="width:140px;"  >
                        <option value=''>黑名单</option>
                        <option value='0' {if $_GPC['partnerblack']=='0'}selected{/if}>否</option>
                        <option value='1' {if $_GPC['partnerblack']=='1'}selected{/if}>是</option>
                    </select>
		 
				 
                        {php echo tpl_daterange('time', array('sm'=>true, 'placeholder'=>'成为合伙人时间'),true);}
						 
 
  	
                 		
                            </div>
					
					
				</div>
  </form>
{if count($list)>0}
 
        <table class="table table-hover table-responsive">
            <thead class="navbar-inner" >
            <tr>
                 <th style="width:25px;"><input type='checkbox' /></th>
          
                <th style='width:100px;'>粉丝</th>
                <th style='width:110px;'>姓名<br/>手机号码</th>
                <th style='width:80px;'>等级</th>
                <th style='width:80px;'>累计分红</th>
                <th style='width:90px;'>注册时间</th>
                <th style='width:90px;'>审核时间</th>
                <th style='width:70px;'>状态</th>
                <th style='width:70px;'>关注</th>
                <th style='width:70px;'>操作</th>
            </tr>
            </thead>
            <tbody>
            {loop $list $row}
           <tr rel="pop" data-title="ID: {$row['id']} " data-content="推荐人 <br/> {if empty($row['agentid'])}
				  {if $row['isagent']==1}
				      <label class='label label-primary'>总店</label>
				      {else}
				       <label class='label label-default'>暂无</label>
				      {/if}
				{else}
				
                    	{if !empty($row['parentavatar'])}
                         <img src='{$row['parentavatar']}' style='width:20px;height:20px;padding1px;border:1px solid #ccc' />
                       {/if}
                       [{$row['partnerid']}]{if empty($row['parentname'])}未更新{else}{$row['parentname']}{/if}
					   {/if}">
               
								<td>
									<input type='checkbox'   value="{$row['id']}"/>
							</td>
               
                <td >
                    <span data-toggle='tooltip' title='{$row['nickname']}'>
                    {if !empty($row['avatar'])}
                    <img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' />
                    {/if}
                    {if empty($row['nickname'])}未更新{else}{$row['nickname']}{/if}
                    </span>
                </td>

                <td>{$row['realname']} <br/> {$row['mobile']}</td>
                <td>{if empty($row['levelname'])} {php echo empty($this->set['levelname'])?'普通等级':$this->set['levelname']}{else}{$row['levelname']}{/if}</td>
             
                <td>{$row['bonus']}</td>
                       <td>{php echo date('Y-m-d',$row['createtime'])}<br/>{php echo date('H:i',$row['createtime'])}</td>
                <td>{if !empty($row['partnertime'])}
                    {php echo date('Y-m-d',$row['partnertime'])}<br/>{php echo date('H:i',$row['partnertime'])}
                {else}
                -
                {/if}
                </td>
                <td>
             
                   
                    <span class='label {if $row['partnerstatus']==1}label-success{else}label-default{/if}'
										  {ifp 'globonus.partner.check'}
										  data-toggle='ajaxSwitch' 
                                          data-confirm ='确认要{if $row['partnerstatus']==1}取消审核{else}审核通过{/if}?'
										  data-switch-value='{$row['partnerstatus']}'
										  data-switch-value0='0|未审核|label label-default|{php echo webUrl('globonus/partner/check',array('status'=>1,'id'=>$row['id']))}'  
										  data-switch-value1='1|已审核|label label-success|{php echo webUrl('globonus/partner/check',array('status'=>0,'id'=>$row['id']))}'  
										  {/if}
										>
										  {if $row['partnerstatus']==1}已审核{else}未审核{/if}</span>
                    <br/>
                    
                    
                       <span class='label {if $row['partnerblack']==0}label-success{else}label-default{/if}' 
										  {ifp 'globonus.partner.partnerblack'}
										  data-toggle='ajaxSwitch' 
                                                                                       data-confirm ='确认要{if $row['partnerblack']==1}取消黑名单{else}设置黑名单{/if}?'
										  data-switch-value='{$row['partnerblack']}'
										  data-switch-value0='0|正常|label label-success|{php echo webUrl('globonus/partner/partnerblack',array('partnerblack'=>1,'id'=>$row['id']))}'  
										  data-switch-value1='1|黑名单|label label-default|{php echo webUrl('globonus/partner/partnerblack',array('partnerblack'=>0,'id'=>$row['id']))}'  
										  {/if}
										>
										  {if $row['partnerblack']==1}黑名单{else}正常{/if}</span>
                     </td>
                <td>
             {if empty($row['followed'])}
                    {if empty($row['uid'])}
                    <label class='label label-default'>未关注</label>
                    {else}
                    <label class='label label-warning'>取消关注</label>
                    {/if}
                    {else}
                    <label class='label label-primary'>已关注</label>
                    {/if}
                    
              
                   
           
                </td>
             
        
                <td  style="overflow:visible;">

                    <div class="btn-group btn-group-sm">
                        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                        <ul class="dropdown-menu dropdown-menu-left">
                            
                            
                            
                            {ifp 'member.list.view'}<li><a href="{php echo webUrl('member/list/detail',array('id' => $row['id']));}" title='会员信息' target='_blank'><i class='fa fa-user'></i> 会员信息</a></li>	{/if}
                            {ifp 'order.list'}<li><a  href="{php echo webUrl('order/list',array('agentid' => $row['id']));}" title='推广订单'  target='_blank'><i class='fa fa-list'></i> 推广订单</a></li>{/if}
                            {ifp 'commission.agent.user'}<li><a  href="{php echo webUrl('commission/agent/user',array('id' => $row['id']));}"  title='推广下线'  target='_blank'><i class='fa fa-users'></i> 推广下线</a></li>{/if}
                            {ifp 'globonus.partner.delete'}<li><a data-toggle='ajaxRemove' href="{php echo webUrl('globonus/partner/delete',array('id' => $row['id']));}" title="删除" data-confirm="确定要删除该合伙人吗？"><i class='fa fa-remove'></i> 删除合伙人</a></li>{/if}

                            <li class='divider'></li>
                            {ifp 'order'}<li><a  href="{php echo webUrl('order/list', array('searchfield'=>'member', 'keyword'=>$row['nickname']))}" title='会员订单'  target='_blank'><i class='fa fa-list'></i> 会员订单</a></li>{/if}
                        {ifp 'finance.recharge.credit1'}<li><a data-toggle="ajaxModal" href="{php echo webUrl('finance/recharge', array('type'=>'credit1','id'=>$row['id']))}" title='充值积分'><i class='fa fa-credit-card'></i> 充值积分</a></li>{/if}
                        {ifp 'finance.recharge.credit2'}<li><a data-toggle="ajaxModal" href="{php echo webUrl('finance/recharge', array('type'=>'credit2','id'=>$row['id']))}" title='充值余额'><i class='fa fa-money'></i> 充值余额 </a></li>{/if}
                        {ifp 'member.list.delete'}<li><a  data-toggle='ajaxRemove'  href="{php echo webUrl('member/list/delete',array('id' => $row['id']));}" title='删除会员' data-confirm="确定要删除该会员吗？"><i class='fa fa-remove'></i> 删除会员</a></li>{/if}
                        
                        </ul>
                    </div>


                </td>
            </tr>
            {/loop}
            </tbody>
        </table>
        {$pager}
        
                {else}
<div class='panel panel-default'>
	<div class='panel-body' style='text-align: center;padding:30px;'>
		 暂时没有任何合伙人!
	</div>
</div>
{/if}
    <script language="javascript">
			  

 
			require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left', 
            title : $(this).data('title'),
            html: 'true', 
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
                    var _this = this;
                    $(this).popover("show"); 
                    $(this).siblings(".popover").on("mouseleave", function () {
                        $(_this).popover('hide');
                    });
                }).on("mouseleave", function () {
                    var _this = this;
                    setTimeout(function () {
                        if (!$(".popover:hover").length) {
                            $(_this).popover("hide")
                        }
                    }, 100);
                });
 
	 
	   });
 
			   
</script> 
 
{template '_footer'}